package com.hdsx.netty.tomcatserver.bio;

import java.io.OutputStream;

/**
 * @author 占贤银
 * time 2024/8/4 22:51
 * description 生命之灯因热情而点燃，生命之舟因拼搏而前行
 */
public class GPResponse {

    private OutputStream os;

    public GPResponse(OutputStream os) {
        this.os = os;
    }

    public void write(String content) {
        try {
            StringBuilder sb = new StringBuilder();
            sb.append("HTTP/1.1 200 OK \n");
            sb.append("Content-Type:text/html;charset=utf-8 \n");
            sb.append("\r\n");
            sb.append(content);
            this.os.write(sb.toString().getBytes());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}